#include <iostream>
using namespace std;

class Point{
private:
    int _ix;
    int _iy;
    static Point *_pointInstance;

    Point(int x ,int y)
    : _ix(x), _iy(y){}

    Point(const Point & rhs)
    : _ix(rhs._ix), _iy(rhs._iy){}

    Point& operator=(const Point& rhs){
        this->_ix = rhs._ix;
        this->_iy = rhs._iy;
        return *this;
    };

public:
    static Point *getInstance(){
        if(_pointInstance == nullptr) {
            _pointInstance = new Point(1, 2);
        }
        return _pointInstance;
    }

    void print(){
        cout << "(" << _ix
             << "," << _iy
             << ")";
    }

    ~Point(){
        cout << "~Point()" << endl;
    }
};
Point *Point::_pointInstance = nullptr;



void test0(){
    Point *point1 = Point::getInstance();
    Point *point2 = Point::getInstance();
    cout << point1 << endl;
    cout << point2 << endl;
}

int main(void){
    test0();
    return 0;
}
